home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / powervww / pvtable.h < prev    next >
C/C++ Source or Header  |  1998-01-05  |  5KB  |  183 lines

  1. //  ____________________________________________________
  2. // |                                                    |
  3. // |  Project:     POWER VIEW INTERFACE                 |
  4. // |  File:        PVTABLE.H                            |
  5. // |  Compiler:    WPP386 (10.6)                        |
  6. // |                                                    |
  7. // |  Subject:     Tables support interface             |
  8. // |                                                    |
  9. // |  Author:      Emil Dotchevski                      |
  10. // |____________________________________________________|
  11. //
  12. // E-mail: zajo@geocities.com
  13. // URL:    http://www.geocities.com/SiliconValley/Bay/3577
  14.  
  15. void __init_tables( void );
  16.  
  17. #ifndef _PVTABLE_H
  18. #define _PVTABLE_H
  19.  
  20. #define MAX_TABLE_XL 1000
  21. #define MAX_TABLE_YL 1000
  22.  
  23. #define whTABLE    1  //column is in the table
  24. #define whMUTE     2  //column is muted
  25. #ifdef TABLEINFO
  26. #define whINFO     3  //column is in the 'details' window
  27. #endif
  28.  
  29. #define atLEFT     0  //align column left
  30. #define atRIGHT    1  //align column right
  31.  
  32. struct Ttable_data
  33. {
  34.   char *title;              //column title
  35.   char width;               //column current width
  36.   char min_width;           //column minimum width
  37.   char max_width;           //column maximum width
  38.   char depth;               //column depth (how deep subcolumns)
  39.   char where;               //whTABLE, whINFO, whMUTE
  40.   char align;               //atLEFT, atRIGHT
  41.   Ttable_data *next;        //next table column in the same level
  42.   Ttable_data *parent;      //parent column
  43.   Ttable_data *nextc;       //next data column
  44.   Ttable_data *nested;      //pointer to list of subitems
  45.   Ttable_data *old_parent;  //used during composition
  46.   Ttable_data *old_item;    //used during composition
  47. };
  48.  
  49. class Ttable;
  50.  
  51. class Ttable_iterator: public Titem
  52. {
  53.   public:
  54.     Ttable_data *data;
  55.     uint &h_beg_print;
  56.     uint &h_size;
  57.     uint &h_count;
  58.     uint &h_current;
  59.     uint &v_beg_print;
  60.     uint &v_count;
  61.     uint &v_current;
  62.     uint _h_beg_print;
  63.     uint _h_size;
  64.     uint _h_count;
  65.     uint _h_current;
  66.     uint _v_beg_print;
  67.     uint _v_count;
  68.     uint _v_current;
  69.     uint hsel_org, vsel_org;
  70.     Ttable_iterator( int _xl, int _yl );
  71.     Ttable_iterator( int _xl, int _yl,
  72.                      uint &hsize, uint &hbeg_print,
  73.                      uint &hcount, uint &hcurrent,
  74.                      uint &vbeg_print, uint &vcount, uint &vcurrent );
  75.     virtual void redraw( void );
  76.     virtual void fetch( char *buffer,
  77.                         uint row, uint column,
  78.                         uint width ) = 0;
  79.     void set_title( char *title );
  80.     virtual void left( void );
  81.     virtual void right( void );
  82.     virtual void up( void );
  83.     virtual void down( void );
  84.     virtual void top( void );
  85.     virtual void bottom( void );
  86.     virtual void at( uint i );
  87.     virtual void update_commands( void );
  88.     void pgup( void );
  89.     void pgdn( void );
  90.  
  91.   protected:
  92.     virtual void draw( void );
  93.     virtual void get_focused( void );
  94.     virtual void event_handler( Tevent &ev );
  95.     virtual void drop( void *data );
  96. };
  97.  
  98. class Tlist_iterator: public Ttable_iterator, public Tlb_list
  99. {
  100.   public:
  101.     Tlist_iterator( int _xl, int _yl );
  102.     Tlist_iterator( int _xl, int _yl, Tlb_list *_list );
  103. };
  104.  
  105. class Ttable: public Titem
  106. {
  107.   public:
  108.     Ttable_data *data;
  109.     Ttable_data *first_col;
  110.     int title_vtab;
  111.     uint title_cols;
  112.     uint title_rows;
  113.     Ttable_iterator *iterator;
  114.     Tvscroll_bar *vbar;
  115.     Thscroll_bar *hbar;
  116.     Ttable( Ttable_data *_data, Ttable_iterator *_iterator );
  117.     virtual ~Ttable( void );
  118.     virtual void resize( int _xl, int _yl );
  119. #ifdef TABLEINFO
  120.     virtual void redraw( void );
  121. #endif
  122.     uint col_width( Ttable_data *t );
  123.     void get_title( uint col, uint row, char *r );
  124.     void set_title_vtab( int _title_vtab );
  125.  
  126.   protected:
  127. #ifdef TABLEINFO
  128.     virtual void get_focused( void );
  129.     virtual boolean release_focus( void );
  130. #endif
  131.     virtual void draw( void );
  132.     virtual void event_handler( Tevent &ev );
  133. #ifdef TABLEINFO
  134.     virtual void drop( void *data );
  135.  
  136.   private:
  137.     boolean dont_touch( Ttable_data *t );
  138. #endif
  139. };
  140.  
  141. #ifdef TABLEINFO
  142. class Ttable_info: public Titem
  143. {
  144.   public:
  145.     uint hbeg_print;
  146.     uint hcount;
  147.     uint vbeg_print;
  148.     uint vcount;
  149.     Ttable_info( void );
  150.     virtual ~Ttable_info( void );
  151.  
  152.   protected:
  153.     virtual void draw( void );
  154.     virtual void event_handler( Tevent &ev );
  155.     virtual void drop( void *data );
  156.     void draw_item( Ttable_data *t );
  157. };
  158. #endif
  159.  
  160. #endif
  161.  
  162. #ifdef DECLARE_PVTABLE_H
  163.   #define GLOBAL
  164. #else
  165.   #define GLOBAL extern
  166. #endif
  167.   #ifdef TABLEINFO
  168.   GLOBAL Ttable_info *table_info;
  169.   GLOBAL Ttable *current_table;
  170.   #endif
  171. #undef GLOBAL
  172.  
  173. void construct_table( char *title, Ttable_iterator *iterator ); //start of table
  174. void dialog_table( char *title, Ttable_iterator *iterator ); //start of dialog table
  175. void subdata( char *t ); //start of table subtitle
  176. Ttable *endt( void ); //end of table/subtitle
  177. Ttable_data *tdata( char *t, uint _min, uint _max ); //table column
  178. void full_title( Ttable_data *t, char *result ); //return full title
  179. void move_table_data( Ttable *table, Ttable_data *data, char where );
  180.  
  181. void _pure_table( void );        boolean __pure_table( void ); //prefix
  182. void _tright( void );            boolean __tright( void );
  183.